package ServiceTest;

import junit.framework.TestCase;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.kaishengit.pojo.Milestone;
import com.kaishengit.pojo.Project;
import com.kaishengit.service.MilestoneService;
import com.kaishengit.service.ProjectService;

public class MilestoneServiceTest extends TestCase {
	private MilestoneService milestoneService;
	private ProjectService projectService;
	public void setUp(){
		ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
		milestoneService = (MilestoneService) ctx.getBean("milestoneService");
		projectService = (ProjectService) ctx.getBean("projectService");
	}
	
	public void findListByPropertiestest(){
		Project project = projectService.findById(1);
		Milestone milestone = (Milestone) milestoneService.findListByProperty("project", project).get(0);
		assertNotNull(milestone);
	}
	
	public void findByPropertiestest(){
		Project project = projectService.findById(1);
		Milestone milestone = (Milestone) milestoneService.findByProperty("project", project);
		assertNotNull(milestone);
	}
}
